package org.jeecg.controller;

import org.apache.ibatis.annotations.Param;

import org.jeecg.domain.ServeType;
import org.jeecg.domain.dto.ResponseResult;
import org.jeecg.domain.vo.ServeTypeVo;
import org.jeecg.service.ServeTypeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("type")
public class ServeTypeController {
    @Autowired
    private ServeTypeService serveTypeService;
    //查询服务列表

    @GetMapping("typeList")
    public ResponseResult typeList(ServeTypeVo serveTypeVo){
        return ResponseResult.okResult(serveTypeService.typeList(serveTypeVo));
    }
    //修改状态禁用开启
    @PostMapping("updatestauts")
    public ResponseResult updatestauts(@Param("id") Long id){
        return ResponseResult.okResult(serveTypeService.updatestauts(id));
    }

    //新增服务类型
    @PostMapping("addtype")
    public ResponseResult addtype(ServeType serveType){
        return ResponseResult.okResult(serveTypeService.save(serveType));
    }

//删除

    @PostMapping("dele")
    public ResponseResult dele(@Param("id") Long id){
        return ResponseResult.okResult(serveTypeService.isdelete(id));
    }
    //查看服务项

    @GetMapping("listId")
    public ResponseResult listId(@Param("id")Integer id){
        return ResponseResult.okResult(serveTypeService.getById(id));
    }
    //修改服务类型

    @PostMapping("updatetype")
    public ResponseResult updatetype(ServeType serveType){
        return ResponseResult.okResult(serveTypeService.updateById(serveType));
    }
}
